import axios from "axios";

const CategoryStory = {
    namespaced:true,
    state:()=>({
        category_list:[]
    }),
    mutations:{
        CategoryMutation(state,list){
            state.category_list =list
        }
    },
    actions:{
        CategoryAction(context){
            axios.get('/catelist?istree=1').then(
                res=>{
                    if(res.code == 403){
                        localStorage.removeItem('log_list')
                        window.location.href = "/#/login"
                       
                    }else{
                        context.commit('CategoryMutation',res.list)
                    }
                    
                   
                }
            )
        }
    }
}
export default CategoryStory